const pattern = {
    // 中文，字母，数字，下划线，减号
    name: /^[a-zA-Z0-9\u4E00-\u9FA5_\-]{4,16}$/,
    // 字母，数字，下划线，减号，特殊字符，不小于6个字符
    pwd: /^[a-zA-Z0-9_\-\!\@\#\$\%\^\&\*\?]{6,}$/,
    email: /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
    phone: /^1[3456789]\d{9}$/,
    wechat: /^[a-zA-Z]([\-_a-zA-Z0-9]{5,19})+$/,
	// 真实姓名
    zhname: /^[\u4E00-\u9FA5]{2,4}$/,
}
module.exports = {
    name: (str)=>{
        return pattern.name.test(str)
    },
    pwd: (str)=>{
        return pattern.pwd.test(str)
    },
    email: (str)=>{
        return pattern.email.test(str)
    },
    phone: (str)=>{
        return pattern.phone.test(str)
    },
    wechat: (str)=>{
        return pattern.wechat.test(str)
    },
    alipay: (str)=>{
        return pattern.email.test(str) || pattern.phone.test(str)
    },
    zhname: (str)=>{
        return pattern.zhname.test(str)
    }
}